package fr.xebia;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.HiddenField;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.util.value.ValueMap;

import fr.xebia.beans.PricedCallGirl;

public class AddToCartForm extends Form {

	private static final long serialVersionUID = 1L;

	private ValueMap properties = new ValueMap();

	public AddToCartForm(String id, String prenom) {
		super(id);

		properties.add("prenom", prenom);
		properties.add("typeSoiree", PricedCallGirl.STANDARD);

		HiddenField prenomField = new HiddenField("prenom", new PropertyModel(properties, "prenom"));
		add(prenomField);

		Label prenomLabel = new Label("prenomLabel", prenom);
		add(prenomLabel);

		TypeSoireeCombo typeSoireeCombo = new TypeSoireeCombo("typeSoiree",
				new PropertyModel(properties, "typeSoiree"));
		add(typeSoireeCombo);
	}

	/**
	 * @see org.apache.wicket.markup.html.form.Form#onSubmit()
	 */
	public final void onSubmit() {
		String prenom = (String) properties.get("prenom");
		String typeSoiree = (String) properties.get("typeSoiree");
		setResponsePage(new PanierPage(prenom, typeSoiree));
	}

}
